package com.dilidili.controller;

import com.dilidili.service.IHistoryService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * 【请填写功能名称】Controller
 * 
 * @author ruoyi
 * @date 2022-03-31
 */
@RestController
@RequestMapping("/system/history")
public class HistoryController
{
    @Autowired
    private IHistoryService historyService;
    @RequestMapping("/findhistory")
    public List<Map> historys(Integer userid){
        return historyService.findhistory(userid);
    }
    @RequestMapping("/findAllHistory")
    public Object historylist(Integer pageNum,Integer pageSize,String text1,Integer userid){
        System.out.println(text1);
        if(text1!=""){
            pageNum=1;
        }
        PageHelper.startPage(pageNum,pageSize);
        List<Map> list=historyService.findAllHistory(text1,userid);
        PageInfo<Map> page=new PageInfo<>(list);
        return page;
    }
    @RequestMapping("/delHistory")
    public Object delHistory(Integer history_videoid,Integer userid){

        return historyService.delHistory(history_videoid,userid);
    }
    @RequestMapping("/delAllHistory")
    public Object delAllHistory(Integer userid){
        return historyService.delAllHistory(userid);
    }
}
